import pygame
import os,sys

import random
from pygame.locals import *
#from bar import Bar
from pygame.sprite import Sprite, Group
from game import Game
from sound import Sound



screen_dimension = ( 1000, 450 )
#pygame.mixer.pre_init(44100,16, 2, 4096)
pygame.init()
#Sound("graphics/background_music").play_music()
pygame.display.set_caption('Age of War')
#screen = pygame.display.set_mode( (800,400), pygame.FULLSCREEN )
screen = pygame.display.set_mode( screen_dimension )
pygame.mouse.set_visible(False)
game = Game(screen)
clock = pygame.time.Clock()

while True:
    clock.tick(60)
    for event in pygame.event.get():
            if event.type == KEYDOWN:
                if event.key == K_ESCAPE:
                    sys.exit()
            else:
                game.handle_event(event)
    if game.is_end():
        print("end_game")
        game.end_game()
    else:
        game.draw_game()

